<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title> 家計簿　</title>
    <script type="text/javascript" src="js/prototype-1.6.0.3.js"></script>
    <script type="text/javascript" src="js/common.js"></script>
    <script type="text/javascript" src="js/dateselect.js"></script>
    <script type="text/javascript" src="js/abstract_list.js"></script>
    <script type="text/javascript" src="js/accountList.js"></script>
    <script type="text/javascript" src="js/table.js"></script>
    <script type="text/javascript" src="js/category.js"></script>
    <link href="css/account.css" rel="stylesheet" type="text/css">
    <link rel="shortcut icon" href="favicon.ico">
  </head>
<body>
  {% include "_menu.html" %}
  <form id="account"  method="get" style="margin-top:20px;">
    <span class="title">日付</span>
    <span id="from_date"> </span>
    <span id="to_date">～</span>
    <div>
      <span class="title" id="items_span"></span>
    </div>
    <input type="submit" value="一覧表示" style="margin-top:10px;" onclick="return dataSend()"/>
  </form>
  <div id="listAccountTable"></div>
  <hr/>
  <div id="account_sum"></div>
  <script type="text/javascript">
  var fromSelector = null;
  var toSelector = null;
  var accountData = null;
  var categoryData= null;
  var accountTable = null;
  function makeTable(dataSet){
    accountTable = new SortableTable({id:'listAccountTable',data_set:dataSet,block_num:20,call_back:add_observe});
    $('account_sum').update("合計:"+ myFormatNumber(accountData.sum) + "円");
  }
  function add_observe(){
    accountData.addObserve();
  }
  function dataSend(){
    accountData = new AccountList({params:Form.serialize("account").parseQuery(),call_back:makeTable});
    return false;
  }
  document.observe('dom:loaded',function(){
    var dateObj = new Date();
    fromSelector = new DateSelector('from','from_date',null,dateObj.getFullYear(),dateObj.getMonth()+1,1);
    toSelector = new DateSelector('to','to_date',null);
    categoryData = new CategoryData('items_span',"normal");
    });
  </script>
</body>
</html>
